﻿using System.Data.SqlClient;

namespace Yglu.BusinessLayer.Entities
{
	public class PromotionCollection : BaseEntityCollection
	{
		#region Constructor

		public PromotionCollection()
		{
		}

		public PromotionCollection(SqlDataReader reader)
		{
			Load(reader);
		}

		#endregion

		#region Loading

		public override sealed void Load(SqlDataReader reader)
		{
			if (Count > 0)
			{
				Clear();
			}

			while (reader.Read())
			{
				Promotion p = new Promotion();
				p.Load(reader);

				Add(p);
			}

			if (!reader.IsClosed)
			{
				reader.Close();
			}

			reader.Dispose();
		}

		#endregion
	}
}